/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.framework.core.exception;

/**
 * 
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-6-11
 * @since 1.0
 */
public class WebControllerException extends ApplicationException {
	
	private static final long serialVersionUID = -8632819605890870865L;
	
	
	public WebControllerException() {
		super();
	}
	
	
	public WebControllerException(String msg) {
		super(msg);
	}
	
	
	public WebControllerException(String msg, Throwable cause) {
		super(msg, cause);
	}
	
	
	public WebControllerException(Throwable cause) {
		super(cause);
	}
	
	
	public WebControllerException(String className, String methodName, String message,
			Throwable cause) {
		super(className, methodName, message, cause);
	}
	
	
	public WebControllerException(String className, String methodName, String message) {
		super(className, methodName, message);
	}
	
	
	public WebControllerException(String txnID, String className, String methodName,
			String message, Throwable cause) {
		super(txnID, className, methodName, message, cause);
	}
	
	
	@SuppressWarnings("rawtypes")
	public boolean contains(Class exClass) {
		if (exClass == null) {
			return false;
		}
		Throwable ex = this;
		while (ex != null) {
			if (exClass.isInstance(ex)) {
				return true;
			}
			if (ex instanceof WebControllerException) {
				
				ex = ((WebControllerException) ex).getCause();
			}
			else {
				ex = null;
			}
		}
		return false;
	}
	
}
